package com.goods.shop.exam;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class E0001 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        List<String> lines=new ArrayList<>();
        String num="";
        int lineNums=4;//四行+1行数字 TODO
        for(int i=0;i<=lineNums;i++){
            if(i!=lineNums){
                String line=scanner.nextLine();
                lines.add(line);
            }
            else{
                num=scanner.nextLine();
            }
        }
        for(int i=0;i<num.length();i++){
            int index=Integer.valueOf(num.substring(i,i+1));
            String line=lines.get(i);
            System.out.print(line.substring(index-1,index));
        }


    }
}
